home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Graphics / Viewers / ACRViewer.1.3 / developer / api / examples / ThreshLoop.m < prev   
Encoding:
Text File  |  1995-05-12  |  884 b   |  40 lines

  1. // This is example source code. It demonstrates the use of the ACRViewer API.
  2. // 
  3. // Jens Breitenborn, 95/05/03
  4.  
  5.  
  6. #import "ACRViewer.h"
  7.  
  8. // The file specified in the command line is opened in ACRViewer.
  9. // The Threshold operator is applied to the image with
  10. // varying parameters.
  11.  
  12. main(int argc, char *argv[])
  13. {
  14. int i;
  15. id acrviewer= [[ACRViewer alloc] init];
  16.  
  17.     if (argc != 2){
  18.         puts("usage:threshloop acr/nema-filename");
  19.         exit(1);
  20.     }
  21.     
  22.     if (!acrviewer) {
  23.         puts("Could not get API for ACRViewer!\n"
  24.              "Probably ACRViewer isn't placed in the\n"
  25.              "WorkspaceManagers' search path.\n");
  26.         exit(1);
  27.     }
  28.  
  29.     if ([acrviewer openACRFile:argv[1] ]){
  30.         [acrviewer useOperator:"Threshold"];
  31.         for (i=0; i<2000; i+= 100){
  32.             char params[256];
  33.             sprintf(params,"Low=%d;High=%d",i,i+200);
  34.             [acrviewer setParameters:params forOperator:"Threshold"];
  35.         }
  36.         [acrviewer useOperator:""];
  37.     }
  38.     
  39. }
  40.